<html>
<head>
	<meta name="description" content="Convenient online tool automatically translates MATLAB source code into Julia, so you can move on to the more interesting task of parallelizing your code." />
	<meta name="keywords" content="matlab,julia,convert,translate,translator,online,translate matlab to julia,convert matlab to julia,translate matlab julia,convert matlab julia,matlab to julia,matlab julia,julia matlab,try julia" />

	<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
	<!-- Google Analytics -->
		<script>
			(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
			(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
			m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
			})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

			ga('create', 'UA-30110053-1', 'auto');
			ga('send', 'pageview');
		</script>
	<!-- End Google Analytics -->
	
	<script>
		/**
		* Function that tracks a click on an outbound link in Analytics.
		* This function takes a valid URL string as an argument, and uses that URL string
		* as the event label. Setting the transport method to 'beacon' lets the hit be sent
		* using 'navigator.sendBeacon' in browser that support it.
		*/
		var trackOutboundLink = function(url) {
			ga('send', 'event', 'outbound', 'click', url, {
				'transport': 'beacon',
				'hitCallback': function(){document.location = url;}
			});
		}
		var trackTranslatorEvent = function(label) {
			ga('send', 'event', 'translator', 'click', label);
		}
		var trackSocialEvent = function(label) {
			ga('send', 'event', 'social', 'click', label);
		}
		var trackOtherEvent = function(label) {
			ga('send', 'event', 'other', 'click', label);
		}
	</script>
	<link rel="icon" href="../me/mooncow.jpg">
	
<style type="text/css"></style>
</head>

<body><a name="top"> </a>
<title>
	MATLAB to Julia translator | MATLAB to Julia converter
</title>
<style type="text/css">
	.link{color:#006633; text-decoration:underline;}
	.link:hover{text-decoration:none;}
	.deadlink{color:#999999; text-decoration:none;}
	.spooky{color:#BBBBBB; text-decoration:none;}
	ul{list-style:none;margin-left:0;padding-left:0;}
	li{padding-left:1.5em;text-indent:0em;}
	li:before{content:"";padding-right:0px;}
	indent{display:inline-block;margin-left:2.5em;}
</style>

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.9";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<br>
<table border="0">
	<tr>
		<td width="200"></td>
		<td width="355"></td>
		<td width="20"></td>
		<td width="125"></td>
		<td width="250"></td>
		<td width="100"></td>
	</tr>
	<tr>
		<td></td>
		<td colspan="5">
			<p>
				&nbsp;
			</p>
			<span style="line-height:1em">
				<h1 style="font-family:Tahoma; color:#999999; font-size:150%; letter-spacing:4px">
					matlab-to-julia
				</h1>
				<h1 style="font-family:Tahoma; color:#999999; font-size:100%; letter-spacing:2px">
					Translates MATLAB source code into Julia.
				</h1>
			</span>
		</td>
	</tr>
	<tr>
		<td></td>
		<td colspan="3" width="500">
			<span style="font-family:verdana; font-size:75%; line-height:1.5em">
				<p>
					<br>
					Some of the fields that could most benefit from parallelization primarily
					use programming languages that were not designed with parallel computing
					in mind. This MATLAB-to-Julia translator begins to approach the problem
					starting with MATLAB, which is syntactically close to Julia. The translator
					aims to do much of the tedious work of converting source code from MATLAB
					to Julia, in hopes that a MATLAB user who is curious about Julia could
					then spend most of their first moments with the language exploring its
					capacity to improve their existing programs rather than wrangling with
					bugs or a new syntax.
				</p>
				<p>
					This translator is not comprehensive, but it should accurately translate
					enough of the most common statements that most of the tedious work of
					translating the code by hand is eliminated. The hope is that you can
					then review the translated Julia code and perhaps make minor corrections
					(<a href="https://docs.julialang.org/en/latest/manual/noteworthy-differences/#Noteworthy-differences-from-MATLAB-1" class="link" onclick="trackOutboundLink('https://docs.julialang.org/en/latest/manual/noteworthy-differences/#Noteworthy-differences-from-MATLAB-1'); return false;">list of differences between MATLAB and Julia</a>,
					<a href="https://cheatsheets.quantecon.org/" class="link" onclick="trackOutboundLink('https://cheatsheets.quantecon.org/'); return false;">cheatsheet</a>),
					but be able to quickly move on to the more interesting task of parallelizing
					your code.
				</p>
				<p>
					<a class="link" onclick="insertDemoCode(); trackTranslatorEvent('inserted demo code');">Click here</a>
					for a demo translation.
					<a class="link" href="https://github.com/lakras/matlab-to-julia/blob/master/matlab_to_julia_translator.js" onclick="trackOutboundLink('https://github.com/lakras/matlab-to-julia/blob/master/matlab_to_julia_translator.js'); return false;">Click here</a>
					to view the source code.
				</p>
				<p>
					Happy coding!
				</p>
				<p>
					&nbsp;
				</p>
			</span>
		</td>
	</tr>
	<tr>
		<td width="200"></td>
		<td colspan="2" width="375">
			<span style="font-family:verdana; font-size:75%; line-height:1.5em">
				<p>
					MATLAB
				</p>
			</span>
		</td>
		<td colspan="2" width="375">
			<span style="font-family:verdana; font-size:75%; line-height:1.5em">
				<p>
					Julia
				</p>
			</span>
		</td>
	</tr>
	<tr>
		<td width="200"></td>
		<td colspan="2" width="375">
			<script type="text/javascript" src="matlab_to_julia_translator.js"></script>
			<script type="text/javascript" src="web_page_functions.js"></script>
			<span style="font-family:verdana; font-size:75%; line-height:1.5em">
				<p>
					<textarea rows="35" style="width: 100%; resize: none;" id="inputField" type="text" onfocus="clearInputField();enableTranslateButton();" onclick="trackTranslatorEvent('clicked MATLAB field');">Enter MATLAB code here.</textarea>
				</p>
			</span>
		</td>
		<td colspan="2" width="375">
			<span style="font-family:verdana; font-size:75%; line-height:1.5em">
				<p>
					<textarea rows="35" style="width: 100%; resize: none;" id="outputField" width="375" type="text" disabled="true" onclick="trackTranslatorEvent('clicked Julia field');">Translated code will appear here.</textarea>
				</p>
			</span>
		</td>
	</tr>
	<tr>
		<td width="200"></td>
		<td colspan="4" width="750">
			<span style="font-family:verdana; font-size:75%; line-height:1.5em">
				<p align="center">
					<button id="translateButton" onclick="runTranslator(); trackTranslatorEvent('translated');">translate!</button>
				</p>
				<p align="center">
					<button id="copyToClipboardButton" onclick="copyToClipboard(); trackTranslatorEvent('copied to clipboard');">copy to clipboard</button>
				</p>
			</span>
		</td>
	</tr>
	<tr>
		<td colspan="5">
			<span style="font-family:verdana; font-size:75%; line-height:1.5em">
				<p>
					&nbsp;
				</p>
			</span>
		</td>
	</tr>
	<tr>
		<td width="200"></td>
		<td width="355" valign="top">
			<span style="font-family:verdana; font-size:75%; line-height:1.5em">
				<p>
					You can <a href="https://github.com/lakras/matlab-to-julia/issues/" class="link" onclick="trackOutboundLink('https://github.com/lakras/matlab-to-julia/issues/'); return false;">file an issue on GitHub</a>
					to report translation bugs or to suggest features or translations you would like to see added.
					If you prefer, you can also
					<a href="https://docs.google.com/forms/d/e/1FAIpQLScvH5sN-TLk69V5hipx9Afk54Srn8muBrhJuoV59KkLEeza-Q/viewform?usp=sf_link" class="link" onclick="trackOutboundLink('https://docs.google.com/forms/d/e/1FAIpQLScvH5sN-TLk69V5hipx9Afk54Srn8muBrhJuoV59KkLEeza-Q/viewform?usp=sf_link'); return false;">fill out this Google form</a>.
				</p>
				<p>
					If this translator was helpful, please spread the word and consider <a href="https://github.com/lakras/matlab-to-julia/" class="link" onclick="trackOutboundLink('https://github.com/lakras/matlab-to-julia/'); return false;">contributing to the codebase</a>.
				</p>
				<p>
					<a href="https://twitter.com/share" class="twitter-share-button" onclick="trackSocialEvent('twitter-share-button');" data-text="Translate #MATLAB source code into #Julia." data-url="https://lakras.github.io/matlab-to-julia/" data-via="lakrasil" data-related="lakrasil" data-show-count="false">Tweet</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
				</p>
				<p>
					<div align="center" class="fb-like" onclick="trackSocialEvent('fb-like');" data-href="https://lakras.github.io/matlab-to-julia/" data-layout="button" data-action="recommend" data-size="small" data-show-faces="false" data-share="true"></div>
				</p>
				<p>
					<script type="text/javascript" src="//www.redditstatic.com/button/button1.js"></script>
				</p>
				<p>
					<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script><script type="IN/Share" data-url="https://lakras.github.io/matlab-to-julia/"></script>
				</p>
				<p>
					&nbsp;
				</p>
				<p>
					<a href="https://github.com/lakras/matlab-to-julia" class="link" onclick="trackOutboundLink('https://github.com/lakras/matlab-to-julia'); return false;"><img src="http://sciencecow.mit.edu/me/tippedcow.jpg" width="200"></a>
				</p>
				<p>
					&nbsp;
				</p>
				<p></p>
			</span>
		</td>
		<td width="20"></td>
		<td colspan="3" width="375" valign="top">
			<span style="font-family:verdana; font-size:75%; line-height:1.5em">
				<p>
					<ul>
						<a id="advancedOptionsLabel" onclick="hideOrExposeOptions();trackTranslatorEvent('hid or exposed advanced options');">&#9660;&nbsp;&nbsp;<u>Advanced options:</u></a>
						<li>
							<label id="optionsLabel1">correct/guide translation of function calls</label>
							<table border = "0">
								<tr>
									<td>
										<span style="font-family:verdana; font-size:75%; line-height:1.5em">
											<ul>
												<li>
													<label id="optionsLabel2">interpret as functions:</label>
												</li>
												<li>
													<label id="optionsLabel3">do not interpret as functions:</label>
												</li>
											</ul>
										</span>
									</td>
									<td width="2"></td>
									<td>
										<span style="font-family:verdana; font-size:75%; line-height:1.5em">
										<input type="text" size="35" id="functionNamesField" onclick="clearFunctionNamesField();clearNotFunctionNamesField();trackTranslatorEvent('clicked function names field');" value="functionName1, functionName2, etc.">
										<br><input type="text" size="35" id="notFunctionNamesField" onclick="clearFunctionNamesField();clearNotFunctionNamesField();trackTranslatorEvent('clicked not function names field');" value="matrixName, variableName, etc.">
										</span>
									</td>
								</tr>
							</table>
						</li>
						<li>
							<table border = "0">
								<tr>
									<td>
										<span style="font-family:verdana; font-size:75%; line-height:1.5em">
											
											<label id="optionsLabel4">translate anonymous MATLAB functions</label>
											<ul>
												<li>
													<label id="optionsLabel5"><input type="radio" id="anonymousOneLinersButton" name="anonymousFunctionsRadioButton" onclick="trackTranslatorEvent('clicked for anonymous Julia functions');" value="value" checked> to anonymous Julia functions</label>
												</li>
												<li>
													<label id="optionsLabel6"><input type="radio" id="nonanonymousOneLinersButton" name="anonymousFunctionsRadioButton" onclick="trackTranslatorEvent('clicked for one-line Julia functions');" value="value"> to compact (one-line) Julia functions</label>
												</li>
											</ul>
										</span>
									</td>
									<td width="10"></td>
									<td>
										<span style="font-family:verdana; font-size:75%; line-height:1.5em">
											<label id="optionsLabel7"><span class="spooky">h = @(x, y) x*y</span></label>
											<br><label id="optionsLabel8" for="anonymousOneLinersButton"><span class="spooky">h = (x, y) -> x*y</span></label>
											<br><label id="optionsLabel9" for="nonanonymousOneLinersButton"><span class="spooky">h(x, y) = x*y</span></label>
										</span>
									</td>
								</tr>
							</table>
						</li>
						<li>
							<label id="optionsLabel10"><input type="checkbox" id="removeSemicolonsCheckbox" onclick="trackTranslatorEvent('clicked remove semicolons checkbox');" value="value" checked> remove semicolons at ends of lines</label>
						</li>
					</ul>
				</p>
			</span>
		</td>
	</tr>
</table>
</body></html>